import java.util.List;

import choco.cp.model.managers.IntConstraintManager;
import choco.kernel.model.variables.integer.IntegerVariable;
import choco.kernel.solver.Solver;
import choco.kernel.solver.constraints.SConstraint;
import choco.kernel.solver.variables.integer.IntDomainVar;


public class SoftLeqManager extends IntConstraintManager {

	@Override
	public SConstraint makeConstraint(Solver solver, IntegerVariable[] vars,
			Object parameters, List<String> options) {
		
		IntDomainVar[] vd = new IntDomainVar[3];
		try {
			vd[0] = solver.getVar(vars[0]);
			vd[1] = solver.getVar(vars[1]);
			vd[2] = solver.getVar(vars[2]);
		}
		catch (Exception e) {
			System.out.println("x, y and/or cost are not correct.");
			System.exit(0);
		}
		for (int i = 0; i < 3; i++) {
			if(solver.getVar(vars[i]).getDomainSize()<1) {
				System.out.println("Domains of x, y and z cannot be null");
				System.exit(0);
			}
		}
		
		return new SoftLeq(vd);
	}

}
